import java.util.Scanner;
import java.util.GregorianCalendar;
import java.util.Calendar;

public class CalendarSeeker {
	public static void main(String[] args) {
		System.out.println("Enter the date in the following format DD MM YYYY");
		Scanner reader = new Scanner(System.in);
		int day = reader.nextInt();
		int month = reader.nextInt();
		int year = reader.nextInt();
		if (((day < 1) || (day > 31)) || ((month < 1) || (month > 12))) {
			System.out.println(String.format("There can not be such a DD MM pair as '%s %s'", String.valueOf(day), String.valueOf(month)));
			return;
		}		
		GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
		
		String[] daysOfWeek = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
		System.out.println(String.format("'%s %s %s' is %s", day, month, year, daysOfWeek[calendar.get(Calendar.DAY_OF_WEEK) - 1]));
	}
}